class Singleton {
    private static Singleton instance = new Singleton();

    private Singleton() {}

    public Singleton getInstance() {
        return instance;
    }
}

class SingletonLazy {
    private static volatile SingletonLazy instance;

    public SingletonLazy getInstance() {
        if(instance == null) {
            synchronized (this) {
                if (instance == null) {
                    instance = new SingletonLazy();
                }
            }
        }
        return instance;
    }

    private SingletonLazy() {}
}

public class Demo1 {
    public static void main(String[] args) {

    }
}
